var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");

module.exports = {
    entry: {
        main: [
            './src/index.jsx'
        ]
    }
    ,
    output: {
        path:__dirname+'/dist/',  //打包输出的路径
        filename: 'main.js'            //打包后的名字
    },
    resolve: {
        extensions: ['', '.js', '.jsx','less','css']//自动添加后缀
    },
    module: {
        loaders:[
            { test: /\.js$/,
                exclude: /node_modules/,
                loaders: ['babel?presets[]=react,presets[]=es2015,presets[]=stage-0']
            },
            { test: /\.jsx$/,
                exclude: /node_modules/,
                loaders: ['jsx-loader?harmony','babel?presets[]=react,presets[]=es2015,presets[]=stage-0']
            },
            {
                test:/\.less$/,
                loader:ExtractTextPlugin.extract('style-loader','css-loader','less-loader')
            },
            {
                test:/\.css$/,
                loader:ExtractTextPlugin.extract('style-loader','css-loader')
            },
            {
                test: /\.(png|jpg)$/, loader: 'url-loader'
            }

        ]
    },
    externals:{
        //'echarts':'./lib/echarts.js'
    },
    plugins: [
        new ExtractTextPlugin(['./css/[name].css'])
        //TODO:没有做在html中添加css操作
    ]
};
